package com.hxzy.service;

import com.github.pagehelper.PageInfo;
import com.hxzy.controller.admin.product.req.ProductAddReq;
import com.hxzy.controller.admin.product.req.ProductEditReq;
import com.hxzy.controller.admin.product.req.ProductReq;
import com.hxzy.controller.admin.product.resp.ProductResp;
import com.hxzy.controller.mobile.product.req.MobileProductReq;
import com.hxzy.controller.mobile.product.resp.MobileProductResp;
import com.hxzy.entity.Product;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import javax.annotation.PostConstruct;
import java.util.List;

/**
* @author Administrator
* @description 针对表【product(商品信息)】的数据库操作Service
* @createDate 2023-06-28 16:38:45
*/
public interface ProductService extends IService<Product> {

    PageInfo<ProductResp> search(ProductReq req);


    /**
     * 新增
     * @param req
     * @return
     */
    boolean add(ProductAddReq req);

    ProductResp findById(Long id);

    /**
     * 修改
     * @param req
     * @return
     */
    boolean edit(ProductEditReq req);

    /**
     * 上下架
     * @param ids
     * @param status
     * @return
     */

    boolean upOrDown(Long[] ids, String status);

    /**
     * 手机端查询
     * @param req
     * @return
     */
    List<MobileProductResp> mobileSearch(MobileProductReq req);

    /**
     * 查询商品并加锁
     * @param dishId
     * @return
     */
    ProductResp lockById(Long dishId);

    /**
     * 更新库存
     * @param id 商品ID
     * @param num 数量
     * @return
     */
    int descNum(@Param(value = "id") Long id, @Param(value = "num")int num);
}
